import 'package:xvideos/hj_model/splash/domain_source_model.dart';
import 'package:xvideos/hj_utils/http_manager.dart';
import 'package:xvideos/tools_base/net/base_resp_bean.dart';

import 'pre_sale_model.dart';

class PreSaleService {
  //金币视频列表+活动详情
  static Future<PreSaleModel?> fetchPresaleConfigAndVideos() async {
    final param = <String, dynamic>{'pageNumber': 1, 'pageSize': 8};
    final res = await httpManager.fetchResponseByGET(
      '/video_gold_coin/list',
      param: param,
      jsonTransformation: (json) => PreSaleModel.fromJson(json),
    );
    return res.data;
  }

  //获取预售状态
  static Future<AdvanceStatus?> fetchAdvanceStatus() async {
    final res = await httpManager.fetchResponseByGET(
      '/product/advanceStatus',
      jsonTransformation: (json) => AdvanceStatus.fromJson(json),
    );
    return res.data;
  }

  //消耗预售卡预付权益
  static Future<BaseRespBean> consumePrivilege({
    int? count = 1,
    String? privilegeType, //coinVideo:金币视频 luckDraw:抽奖 aiUndress:AI脱衣 download:下载
  }) async {
    final param = {
      'count': count,
      'privilegeType': privilegeType,
    };
    final result = await httpManager.fetchResponseByPOST(
      '/mine/privilege/consume',
      param: param,
    );
    return result;
  }
}
